<?php

$server_missmatch_config = array();
if (ini_get('register_globals'))
{
   $server_missmatch_config['register_globals'] = 'Off';
}
if (ini_get('magic_quotes_gpc'))
{
   $server_missmatch_config['magic_quotes_gpc'] = 'Off';
}
if (ini_get('safe_mode'))
{
   $server_missmatch_config['safe_mode'] = 'Off';
}
$vIMagick = detect_iMagickVersion();
if (!$vIMagick)
{
   $server_missmatch_config['ImageMagick'] = 'Install';
}

$SMARTY->assign('server_missmatch_config', $server_missmatch_config);

if (!empty($_POST['search']))
{
   $sql = 'SELECT a.id AS id, cat, title 
      FROM meccano_articles AS a, meccano_articles_translate AS at 
      WHERE a.id = at.id
      AND lang = '. $REQUEST->getLangDefaultId() .' 
      AND deleted IS NULL
      AND '. ($FILTER->isValidInteger($_POST['search']) ? 'a.id = "%i"' : '`title` LIKE "%%s%"');
   
   $DB->DB_QueryBuilder($sql, array($_POST['search']));
   $DB->DB_Fetch();

   $SMARTY->assign('data', $DB->fetched);
}

$layout = 'welcome.html';